#include <cstdio>
#include <queue>

using namespace std;

const int Limit_Size = 100100 + 10;

struct Node
{
    int Condition;
    int Count;
};

int S[ 3 ], Min_Count;
queue<Node> q;
bool use[ Limit_Size ];

void init( )
{
    memset( use, true, sizeof( use ) );
    while ( !q.empty( ) )
        q.pop( );
}

void AddNode( int v, int count )
{
    Node tmp;
    use[ v ] = false;
    tmp.Condition = v;
    tmp.Count = count + 1;
    q.push( tmp );
}

bool work( )
{
    if ( S[ 0 ] & 1 )
        return false;
    int target1 = S[ 0 ] / 2, target2, target3, V[ 3 ], Vt0, Vt1, Vt2, i, j;
    Node t, tmp;
    bool goal = false;
    target1 = target1 * 1000 + target1;
    target2 = S[ 0 ] / 2;
    target3 = S[ 0 ] * 500;
    use[ S[ 0 ] * 1000 ] = false;
    t.Condition = S[ 0 ] * 1000;
    t.Count = 0;
    q.push( t );
//    printf("%d %d %d\n", target1, target2, target3);
    while ( !q.empty( ) )
    {
        t = q.front( );
        if ( t.Condition == target1 || t.Condition == target2 || t.Condition == target3 )
        {
            Min_Count = t.Count;
            goal = true;
            break;
        }
        Vt0 = V[ 0 ] = t.Condition / 1000;
        Vt1 = V[ 1 ] = t.Condition - Vt0 * 1000;
        Vt2 = V[ 2 ] = S[ 0 ] - Vt0 - Vt1;
//        printf("%d %d %d\n", Vt0, Vt1, Vt2);
        for ( i = 0; i < 3; i++ )
        {
            for ( j = 0; j < 3; j++ )
            {
                if ( i == j )
                    continue;
                V[ 0 ] = Vt0; V[ 1 ] = Vt1; V[ 2 ] = Vt2;
                V[ i ] += V[ j ];
                V[ j ] = V[ i ] - S[ i ];
                if ( V[ j ] < 0 ) V[ j ] = 0;
                V[ i ] -= V[ j ];
                if ( use[ V[ 0 ] * 1000 + V[ 1 ] ] )
                    AddNode( V[ 0 ] * 1000 + V[ 1 ], t.Count );
            }
        }
        q.pop( );
    }
    return goal;
}

int main( )
{
    while ( scanf("%d%d%d", &S[ 0 ], &S[ 1 ], &S[ 2 ]) != EOF )
    {
        if ( S[ 0 ] == 0 && S[ 1 ] == 0 && S[ 2 ] == 0 )
            break;
        init( );
        if ( work( ) )
            printf("%d\n", Min_Count);
        else
            puts("NO");
    }
    return 0;
}
